﻿ 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Framework;
using OLTS.DAL;
using OLTS.MODEL;

namespace OLTS.DATA_SERVICE
{
    public class Religion_Service
    {
        private OTS_RELIGION _objApp = new OTS_RELIGION();

        public Religion_Service(OTS_RELIGION objApp)
        { 
            _objApp = objApp;
        }

        public Religion_Service()
        {

        }

        public List<OTS_RELIGION> GetAll()
        {
            using (var ctx = new Entities())
            {
                var list = ctx.OTS_RELIGION.ToList();
                return list;
            }
        }

        public void GetAllinclude()
        {

        }

        public void Edit()
        {
            using (var ctx = new Entities())
            {
                var obj = ctx.OTS_RELIGION.Where(x => x.ID == _objApp.ID).FirstOrDefault();
                 
                ctx.SaveChanges();
            }
        }

        public void Add()
        {
            using (var ctx = new Entities())
            {
                ctx.OTS_RELIGION.AddObject(_objApp);
                ctx.SaveChanges();
            }
        }
         
        public void Delete()
        { 
            using (var ctx = new Entities())
            {
                var obj = ctx.OTS_RELIGION.Where(x => x.ID == _objApp.ID).FirstOrDefault();
                ctx.OTS_RELIGION.DeleteObject(obj);
                ctx.SaveChanges();
            }
            
        }

    }
}
